package com.tanhua.admin.controller;

import com.tanhua.admin.service.DashboardService;
import com.tanhua.model.vo.SummaryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author kcs
 * @date 2022/1/8
 * @TIME:17:01
 */
@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private DashboardService dashboardService;

    /**
     * 新增、活跃用户、次日留存率
     * @param sd
     * @param ed
     * @param type
     * @return
     */
    @GetMapping("/users")
    public ResponseEntity users(String sd, String ed, String type){
        Map map = dashboardService.users(sd,ed,type);
        return ResponseEntity.ok(map);
    }


    @GetMapping("/summary")
    public ResponseEntity summary(){
        SummaryVo vo = dashboardService.summary();
        return ResponseEntity.ok(vo);
    }
}
